home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume7 / ularn / patch2a < prev    next >
Encoding:
Internet Message Format  |  1989-07-20  |  52.6 KB

  1. Path: uunet!zephyr!tektronix!tekgen!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v07i042:  ularn - ultra-larn, an enhancement of the larn adventure game, Patch2a
  5. Message-ID: <4281@tekred.CNA.TEK.COM>
  6. Date: 19 Jul 89 14:13:14 GMT
  7. Sender: nobody@tekred.CNA.TEK.COM
  8. Lines: 1951
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: "Scott S. Snyder" <ssnyder@tybalt.caltech.edu>
  12. Posting-number: Volume 7, Issue 42
  13. Archive-name: ularn/Patch2a
  14. Patch-To: ularn: Volume 7, Issue 1-9
  15.  
  16.  
  17. [[This posting contains patches to allow Ularn to compile and run on
  18.   MS-DOS systems, using Turbo C v2.0.]]
  19.  
  20. #! /bin/sh
  21. # This is a shell archive, meaning:
  22. # 1. Remove everything above the #! /bin/sh line.
  23. # 2. Save the resulting text in a file.
  24. # 3. Execute the file with /bin/sh (not csh) to create the files:
  25. #    patch02.1
  26. # This archive created: Sun Jul 16 07:21:26 1989
  27. export PATH; PATH=/bin:$PATH
  28. echo shar: extracting "'patch02.1'" '(50636 characters)'
  29. if test -f 'patch02.1'
  30. then
  31.     echo shar: will not over-write existing file "'patch02.1'"
  32. else
  33. sed 's/^X//' << \SHAR_EOF > 'patch02.1'
  34. Xdiff -c orig/README.dos new/README.dos
  35. X*** orig/README.dos    Sun Jul 16 05:19:15 1989
  36. X--- new/README.dos    Sun Jul 16 04:59:16 1989
  37. X***************
  38. X*** 0 ****
  39. X--- 1,84 ----
  40. X+ 
  41. X+   This set of patches will allow Ularn to compile and run under Mess-Dos
  42. X+ using Turbo C v2.0. Installation instructions, in brief:
  43. X+ 
  44. X+   1. Apply the patches.
  45. X+   2. Edit ularn.lnk, and change the directory names to wherever you keep the
  46. X+      Turbo C libraries.
  47. X+   3. Rename 'makefile.tcc' to 'makefile'.
  48. X+   4. Run make.
  49. X+   5. Copy ularn.exe and the data files ufortune, uhelp, and umaps to wherever
  50. X+      you want to keep them.
  51. X+   6. You must have ANSI.SYS (or NANSI.SYS) installed in order to use Ularn.
  52. X+   7. When running the program, you can specify your character name on the
  53. X+      command line by using 'ularn character-name'. If you don't specify a
  54. X+      name on the command line or in an options file, you will be asked to
  55. X+      enter a name when the game starts.
  56. X+ 
  57. X+ 
  58. X+   The changes that I made fall into several classes:
  59. X+ 
  60. X+ New features:
  61. X+ 
  62. X+   1. Graphics characters. You can specify arbitrary character codes to be
  63. X+ used for drawing the floor and walls of the dungeon. This is done by a
  64. X+ line in the options file of the form 'graphics: floor-code wall-code'.
  65. X+ For example, I use 'graphics: 176 178'.
  66. X+ 
  67. X+   2. Swapping. If memory is limited, levels that are not currently in use
  68. X+ will be swapped out to disk. This feature is enabled by defining the
  69. X+ symbol SWAPPING when compiling savelev.c.
  70. X+ 
  71. X+   Warning: the savefile format has been changed. Finish any old games before
  72. X+ installing this version!
  73. X+ 
  74. X+ 
  75. X+ Modifications for MS-DOS:
  76. X+ 
  77. X+   1. Location of options file. If an options file is specified on the command
  78. X+ line, Ularn will look for it there and abort if it isn't found. Otherwise,
  79. X+ Ularn will try to open the file 'ularnopt', first in the current directory,
  80. X+ and then in the directory in which ularn.exe is located.
  81. X+ 
  82. X+   2. Location of data files. Ularn expects its data files to be in the
  83. X+ directory that ularn.exe is located in. This can be overridden by using
  84. X+ the 'larn-path:' keyword in the options file.
  85. X+ 
  86. X+   3. Character name and save files. The character name can be specified on
  87. X+ the command line ('ularn character-name') or in the options file. If it
  88. X+ is given by both methods, the name specified on the command line takes
  89. X+ precedence. If it is given by neither, you will be asked to enter a name
  90. X+ when the game starts. The name used for the save file will be the first
  91. X+ eight characters of your character's name, followed by '.sav'. This can
  92. X+ be overridden, however, by using the 'savefile:' keyword in the options
  93. X+ file.
  94. X+ 
  95. X+   4. Keypad support. If you have an IBM compatible and want to use the
  96. X+ keypad for movement, include the 'keypad' keyword in the options file.
  97. X+ You can then move around using the eight directional keys (Num Lock
  98. X+ should be _off_). You can run in a given direction by shifting a directional
  99. X+ key. Ins is equivalent to 'i' and Del is equivalent to '.'.
  100. X+ 
  101. X+   5. NANSI support. If you are using NANSI.SYS instead of ANSI.SYS, you
  102. X+ should include the 'nansi' keyword in the options file. Ularn will then
  103. X+ use the insert-line and delete-line control sequences. If you have an IBM
  104. X+ compatible, you can also set the 'rawio' option, which results in faster
  105. X+ output.
  106. X+ 
  107. X+   6. Screen color. You can specify the foreground and background colors
  108. X+ of the screen by using the options 'foreground:' and 'background:', e.g.,
  109. X+ 'foreground: magenta' or 'background: blue'. Most combinations look pretty
  110. X+ ghastly, though.
  111. X+ 
  112. X+ 
  113. X+ Bug fixes:
  114. X+ 
  115. X+   Mostly int/long mismatches. I also ran across a TC code generation bug
  116. X+ and had to rearrange several lines to avoid it. I'm sure there are still
  117. X+ some left, but I've already spent too much time ... um ... _testing_ this
  118. X+ program... :-)
  119. X+ 
  120. X+ Enjoy,
  121. X+ 
  122. X+ Scott Snyder
  123. X+ ssnyder@tybalt.caltech.edu
  124. Xdiff -c orig/Makefile.tcc new/Makefile.tcc
  125. X*** orig/Makefile.tcc    Sun Jul 16 05:19:07 1989
  126. X--- new/Makefile.tcc    Sun Jul 16 04:59:02 1989
  127. X***************
  128. X*** 0 ****
  129. X--- 1,57 ----
  130. X+ #       your favorite compiler
  131. X+ CC      =       tcc
  132. X+ 
  133. X+ #       user id of wizard       (wizard password is defined in config.c)
  134. X+ WIZID   =       0
  135. X+ 
  136. X+ #       name of program
  137. X+ GAME    =       Ularn.exe
  138. X+ 
  139. X+ #       program options
  140. X+ OPTIONS =       -DWIZID=$(WIZID)
  141. X+ 
  142. X+ #       compile flags
  143. X+ CFLAGS = -v -mh $(OPTIONS)
  144. X+ 
  145. X+ #       link flags
  146. X+ LDFLAGS = /v
  147. X+ 
  148. X+ #       the object files
  149. X+ OBJ     = bill.obj config.obj create.obj data.obj diag.obj display.obj \
  150. X+         fortune.obj global.obj help.obj io.obj main.obj monster.obj \
  151. X+         moreobj.obj movem.obj object.obj regen.obj savelev.obj scores.obj \
  152. X+         signal.obj store.obj tok.obj nap.obj
  153. X+ 
  154. X+ #       the source files
  155. X+ SRC     = bill.c config.c create.c data.c diag.c display.c fortune.c\
  156. X+         global.c help.c io.c main.c monster.c moreobj.c movem.c object.c\
  157. X+         regen.c savelev.c scores.c signal.c store.c tok.c nap.c
  158. X+ 
  159. X+ #       the header file
  160. X+ HDR     = header.h
  161. X+ 
  162. X+ UTIL = to_ansi.exe
  163. X+ UTIL_OBJ = to_ansi.obj
  164. X+ UTIL_SRC = to_ansi.c
  165. X+ 
  166. X+ ##########################################################################
  167. X+ 
  168. X+ love:   $(GAME) Uhelp
  169. X+ 
  170. X+ $(GAME): $(OBJ)
  171. X+         tlink $(LDFLAGS) @ularn.lnk
  172. X+ 
  173. X+ .c.obj:
  174. X+         $(CC) -c $(CFLAGS) $.
  175. X+ 
  176. X+ $(OBJ): header.h
  177. X+ 
  178. X+ $(UTIL): $(UTIL_SRC)
  179. X+         tcc $(UTIL_SRC)
  180. X+ 
  181. X+ #$(UTIL): $(UTIL_OBJ)
  182. X+ #       $(CC) $(UTIL_OBJ)
  183. X+ 
  184. X+ Uhelp: $(UTIL) Uhelp.no_control
  185. X+         makehelp
  186. X+ 
  187. Xdiff -c orig/Uhelp.no_control new/Uhelp.no_control
  188. X*** orig/Uhelp.no_control    Sun Jul 16 01:06:32 1989
  189. X--- new/Uhelp.no_control    Sun Jul 16 05:03:58 1989
  190. X***************
  191. X*** 1,4 ****
  192. X! 5    Welcome to the game of Ularn.  At this moment, you face a great problem.
  193. X  Your daughter has contracted a strange disease, and none of your home remedies
  194. X  seem to have any effect.  You sense that she is in mortal danger, and you must
  195. X  try to save her.  Time ago you heard of a land of great danger and opportunity.
  196. X--- 1,4 ----
  197. X! 6    Welcome to the game of Ularn.  At this moment, you face a great problem.
  198. X  Your daughter has contracted a strange disease, and none of your home remedies
  199. X  seem to have any effect.  You sense that she is in mortal danger, and you must
  200. X  try to save her.  Time ago you heard of a land of great danger and opportunity.
  201. X***************
  202. X*** 107,118 ****
  203. X                    letter of name is monster's character.
  204. X      savefile: save-file-name      full pathname of savefile
  205. X      character: character      choose your character
  206. X  
  207. X  Your name and monster names must be enclosed in double quotation marks and may
  208. X  be up to 34 characters long.  Longer names are truncated.  Anything enclosed in
  209. X  quotation marks is considered one word, and must be separated from other words
  210. X  by whitespace.
  211. X- 
  212. X             ^[[7mExplanation of the Ularn scoreboard facility^[[m
  213. X  
  214. X      Ularn supports TWO scoreboards, one for winners, and one for deceased
  215. X--- 107,118 ----
  216. X                    letter of name is monster's character.
  217. X      savefile: save-file-name      full pathname of savefile
  218. X      character: character      choose your character
  219. X+     graphics: floor-chr wall-chr  char codes to use to draw floor and walls
  220. X  
  221. X  Your name and monster names must be enclosed in double quotation marks and may
  222. X  be up to 34 characters long.  Longer names are truncated.  Anything enclosed in
  223. X  quotation marks is considered one word, and must be separated from other words
  224. X  by whitespace.
  225. X             ^[[7mExplanation of the Ularn scoreboard facility^[[m
  226. X  
  227. X      Ularn supports TWO scoreboards, one for winners, and one for deceased
  228. X***************
  229. X*** 129,134 ****
  230. X--- 129,155 ----
  231. X  at the time of his death.
  232. X  
  233. X  
  234. X+ 
  235. X+ 
  236. X+ 
  237. X+ 
  238. X+ 
  239. X+ 
  240. X+ 
  241. X+                      ^[[7mAdditional options for MS-DOS^[[m
  242. X+ 
  243. X+   If you are running Ularn under MSDOS, there are several other options
  244. X+ which can be in your 'ularnopt' file:
  245. X+ 
  246. X+     Word                     Meaning
  247. X+     larn-path: directory          the directory where the data files are kept
  248. X+     background: color             the background screen color
  249. X+     foreground: color             the foreground screel color
  250. X+     nansi                         you have NANSI.SYS installed instead of
  251. X+                                   ANSI.SYS.
  252. X+     rawio                         faster screen output (requires NANSI.SYS and
  253. X+                                   an IBM compatible)
  254. X+     keypad                        use the numeric keypad for movement
  255. X  
  256. X  
  257. X  
  258. Xdiff -c orig/bill.c new/bill.c
  259. X*** orig/bill.c    Sun Jul 16 00:59:47 1989
  260. X--- new/bill.c    Sun Jul 16 04:38:37 1989
  261. X***************
  262. X*** 3,8 ****
  263. X--- 3,9 ----
  264. X  #include "header.h"
  265. X  
  266. X  static char mail600[32];
  267. X+ 
  268. X  /*
  269. X   *    function to create the tax bill for the user
  270. X   */
  271. X***************
  272. X*** 9,20 ****
  273. X  static int pid;
  274. X  letter1()
  275. X  {
  276. X      sprintf(mail600, "/tmp/#%dmail600",pid); /* prepare path */
  277. X!     if (lcreat(mail600) < 0) { 
  278. X          write(1,"can't write 600 letter\n",23); 
  279. X          return(0);
  280. X      }
  281. X  lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  282. X  lprcat("From:"); 
  283. X  lprcat("  the URS (Ularn Revenue Service)\n");
  284. X  lprcat("\nSubject:"); 
  285. X--- 10,25 ----
  286. X  static int pid;
  287. X  letter1()
  288. X  {
  289. X+ #ifdef __MSDOS__
  290. X+         clear();
  291. X+ #else
  292. X      sprintf(mail600, "/tmp/#%dmail600",pid); /* prepare path */
  293. X!     if (lcreat(mail600,0) < 0) { 
  294. X          write(1,"can't write 600 letter\n",23); 
  295. X          return(0);
  296. X      }
  297. X  lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  298. X+ #endif
  299. X  lprcat("From:"); 
  300. X  lprcat("  the URS (Ularn Revenue Service)\n");
  301. X  lprcat("\nSubject:"); 
  302. X***************
  303. X*** 31,48 ****
  304. X  lprcat("\nof this notice, and is due within 5 days.  Failure to pay will");
  305. X  lprcat("\nmean penalties.  Once again, congratulations, We look forward");
  306. X  lprcat("\nto your future successful expeditions.\n");
  307. X      lwclose(); 
  308. X      return(1);
  309. X  }
  310. X  
  311. X  letter2()
  312. X  {
  313. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  314. X!     if (lcreat(mail600) < 0) { 
  315. X          write(1,"can't write 601 letter\n",23); 
  316. X          return(0);
  317. X      }
  318. X  lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  319. X  lprcat("From:"); 
  320. X  lprcat("  His Majesty King Wilfred of Ularndom\n");
  321. X  lprcat("\nSubject:"); 
  322. X--- 36,62 ----
  323. X  lprcat("\nof this notice, and is due within 5 days.  Failure to pay will");
  324. X  lprcat("\nmean penalties.  Once again, congratulations, We look forward");
  325. X  lprcat("\nto your future successful expeditions.\n");
  326. X+ 
  327. X+ #ifdef __MSDOS__
  328. X+         retcont();
  329. X+ #else
  330. X      lwclose(); 
  331. X+ #endif
  332. X      return(1);
  333. X  }
  334. X  
  335. X  letter2()
  336. X  {
  337. X+ #ifdef __MSDOS__
  338. X+         clear();
  339. X+ #else
  340. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  341. X!     if (lcreat(mail600,0) < 0) { 
  342. X          write(1,"can't write 601 letter\n",23); 
  343. X          return(0);
  344. X      }
  345. X  lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  346. X+ #endif
  347. X  lprcat("From:"); 
  348. X  lprcat("  His Majesty King Wilfred of Ularndom\n");
  349. X  lprcat("\nSubject:"); 
  350. X***************
  351. X*** 56,73 ****
  352. X  lprcat("\nhonour of Knightess of the realm.  Upon thy name shall it be written. . .");
  353. X  lprcat("\nBravery and courage be yours.");
  354. X  lprcat("\nMay you live in happiness forevermore . . .\n");
  355. X  lwclose(); 
  356. X  return(1);
  357. X  }
  358. X  
  359. X  letter3()
  360. X  {
  361. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  362. X!     if (lcreat(mail600) < 0) { 
  363. X          write(1,"can't write 602 letter\n",23); 
  364. X          return(0);
  365. X      }
  366. X      lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  367. X      lprcat("From:"); 
  368. X      lprcat("  Count Endelford\n");
  369. X      lprcat("\nSubject:"); 
  370. X--- 70,95 ----
  371. X  lprcat("\nhonour of Knightess of the realm.  Upon thy name shall it be written. . .");
  372. X  lprcat("\nBravery and courage be yours.");
  373. X  lprcat("\nMay you live in happiness forevermore . . .\n");
  374. X+ #ifdef __MSDOS__
  375. X+ retcont();
  376. X+ #else
  377. X  lwclose(); 
  378. X+ #endif
  379. X  return(1);
  380. X  }
  381. X  
  382. X  letter3()
  383. X  {
  384. X+ #ifdef __MSDOS__
  385. X+         clear();
  386. X+ #else
  387. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  388. X!     if (lcreat(mail600,0) < 0) { 
  389. X          write(1,"can't write 602 letter\n",23); 
  390. X          return(0);
  391. X      }
  392. X      lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  393. X+ #endif
  394. X      lprcat("From:"); 
  395. X      lprcat("  Count Endelford\n");
  396. X      lprcat("\nSubject:"); 
  397. X***************
  398. X*** 83,100 ****
  399. X  lprcat("With several attempts I have yet to endure the");
  400. X  lprcat(" caves,\nand you, a nobody, makes the journey!  From this time");
  401. X  lprcat(" onward, bewarned\nupon our meeting you shall pay the price!\n");
  402. X      lwclose(); 
  403. X      return(1);
  404. X  }
  405. X  
  406. X  letter4()
  407. X  {
  408. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  409. X!     if (lcreat(mail600) < 0) { 
  410. X          write(1,"can't write 603 letter\n",23); 
  411. X          return(0);
  412. X      }
  413. X      lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  414. X      lprcat("From:"); 
  415. X      lprcat("  Mainair, Duke of Ularnty\n");
  416. X      lprcat("\nSubject:"); 
  417. X--- 105,130 ----
  418. X  lprcat("With several attempts I have yet to endure the");
  419. X  lprcat(" caves,\nand you, a nobody, makes the journey!  From this time");
  420. X  lprcat(" onward, bewarned\nupon our meeting you shall pay the price!\n");
  421. X+ #ifdef __MSDOS__
  422. X+         retcont();
  423. X+ #else
  424. X      lwclose(); 
  425. X+ #endif
  426. X      return(1);
  427. X  }
  428. X  
  429. X  letter4()
  430. X  {
  431. X+ #ifdef __MSDOS__
  432. X+         clear();
  433. X+ #else
  434. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  435. X!     if (lcreat(mail600,0) < 0) { 
  436. X          write(1,"can't write 603 letter\n",23); 
  437. X          return(0);
  438. X      }
  439. X      lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  440. X+ #endif
  441. X      lprcat("From:"); 
  442. X      lprcat("  Mainair, Duke of Ularnty\n");
  443. X      lprcat("\nSubject:"); 
  444. X***************
  445. X*** 105,122 ****
  446. X  lprcat("\nyearn to behold his anger and jealously.  Should ye choose to");
  447. X  lprcat("\nunleash some of thy wealth upon those who be unfortunate, I,");
  448. X      lprcat("\nDuke Mainair, Shall equal thy gift also.\n");
  449. X      lwclose(); 
  450. X      return(1);
  451. X  }
  452. X  
  453. X  letter5()
  454. X  {
  455. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  456. X!     if (lcreat(mail600) < 0) { 
  457. X          write(1,"can't write 604 letter\n",23); 
  458. X          return(0);
  459. X      }
  460. X      lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  461. X      lprcat("From:"); 
  462. X      lprcat("  St. Mary's Children's Home\n");
  463. X      lprcat("\nSubject:"); 
  464. X--- 135,160 ----
  465. X  lprcat("\nyearn to behold his anger and jealously.  Should ye choose to");
  466. X  lprcat("\nunleash some of thy wealth upon those who be unfortunate, I,");
  467. X      lprcat("\nDuke Mainair, Shall equal thy gift also.\n");
  468. X+ #ifdef __MSDOS__
  469. X+         retcont();
  470. X+ #else
  471. X      lwclose(); 
  472. X      return(1);
  473. X+ #endif
  474. X  }
  475. X  
  476. X  letter5()
  477. X  {
  478. X+ #ifdef __MSDOS__
  479. X+         clear();
  480. X+ #else
  481. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  482. X!     if (lcreat(mail600,0) < 0) { 
  483. X          write(1,"can't write 604 letter\n",23); 
  484. X          return(0);
  485. X      }
  486. X      lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  487. X+ #endif
  488. X      lprcat("From:"); 
  489. X      lprcat("  St. Mary's Children's Home\n");
  490. X      lprcat("\nSubject:"); 
  491. X***************
  492. X*** 133,150 ****
  493. X  lprcat("\ngood food.  Could you possibly find it in your heart to help us");
  494. X      lprcat("\nin our plight?  Whatever you could give will help much.");
  495. X      lprcat("\n(your gift is tax deductible)\n");
  496. X      lwclose(); 
  497. X      return(1);
  498. X  }
  499. X  
  500. X  letter6()
  501. X  {
  502. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  503. X!     if (lcreat(mail600) < 0) { 
  504. X          write(1,"can't write 605 letter\n",23); 
  505. X          return(0);
  506. X      }
  507. X      lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  508. X      lprcat("From:"); 
  509. X      lprcat("  The National Dianthroritis Society of Ularn\n");
  510. X      lprcat("\nSubject:"); 
  511. X--- 171,196 ----
  512. X  lprcat("\ngood food.  Could you possibly find it in your heart to help us");
  513. X      lprcat("\nin our plight?  Whatever you could give will help much.");
  514. X      lprcat("\n(your gift is tax deductible)\n");
  515. X+ #ifdef __MSDOS__
  516. X+         retcont();
  517. X+ #else
  518. X      lwclose(); 
  519. X+ #endif
  520. X      return(1);
  521. X  }
  522. X  
  523. X  letter6()
  524. X  {
  525. X+ #ifdef __MSDOS__
  526. X+         clear();
  527. X+ #else
  528. X      sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
  529. X!     if (lcreat(mail600,0) < 0) { 
  530. X          write(1,"can't write 605 letter\n",23); 
  531. X          return(0);
  532. X      }
  533. X      lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  534. X+ #endif
  535. X      lprcat("From:"); 
  536. X      lprcat("  The National Dianthroritis Society of Ularn\n");
  537. X      lprcat("\nSubject:"); 
  538. X***************
  539. X*** 159,165 ****
  540. X--- 205,215 ----
  541. X  lprcat("\ndreaded disease, and you can help today.  Could you please see it");
  542. X  lprcat("\nin your heart to give generously?  Your continued good health");
  543. X      lprcat("\ncan be your everlasting reward.\n");
  544. X+ #ifdef __MSDOS__
  545. X+         retcont();
  546. X+ #else
  547. X      lwclose(); 
  548. X+ #endif
  549. X      return(1);
  550. X  }
  551. X  
  552. X***************
  553. X*** 175,191 ****
  554. X--- 225,247 ----
  555. X      register int i;
  556. X      char buf[128];
  557. X  
  558. X+ #ifndef __MSDOS__
  559. X      wait(0);  
  560. X      pid=getpid();
  561. X      if (fork() == 0) {
  562. X+ #endif
  563. X          resetscroll();
  564. X          for (i=0; i<sizeof(pfn)/sizeof(int (*)()); i++)
  565. X              if ((*pfn[i])()) {
  566. X+ #ifndef __MSDOS__
  567. X                  sleep(20);  
  568. X                  sprintf(buf,"mail %s < %s",loginname,mail600);
  569. X                  system(buf);  
  570. X                  unlink(mail600);
  571. X+ #endif
  572. X              }
  573. X+ #ifndef __MSDOS__
  574. X          exit(0);
  575. X      }
  576. X+ #endif
  577. X  }
  578. Xdiff -c orig/config.c new/config.c
  579. X*** orig/config.c    Sun Jul 16 01:06:34 1989
  580. X--- new/config.c    Sun Jul 16 04:49:20 1989
  581. X***************
  582. X*** 7,32 ****
  583. X   */
  584. X  #include "header.h"
  585. X  
  586. X  /* the game save filename   */
  587. X  char savefilename[SAVEFILENAMESIZE] =     HOME;
  588. X  
  589. X  /* the score file            */
  590. X! char scorefile[sizeof(HOME)+sizeof(SCORENAME)] =    HOME;
  591. X  
  592. X  /* the logging file        */
  593. X! char logfile[sizeof(HOME)+sizeof(LOGFNAME)]  =    HOME;
  594. X  
  595. X  /* the help text file    */
  596. X! char helpfile[sizeof(HOME)+sizeof(HELPNAME)] =    HOME;
  597. X  
  598. X  /* the maze data file    */
  599. X! char larnlevels[sizeof(HOME)+sizeof(LEVELSNAME)] =     HOME;
  600. X  
  601. X  /* the fortune data file */
  602. X! char fortfile[sizeof(HOME)+sizeof(FORTSNAME)] =    HOME;
  603. X  
  604. X  /* the .Ularnopts filename */
  605. X! char optsfile[128] ="/.Ularnopts";    /* the option file */
  606. X  
  607. X  char diagfile[] ="Diagfile";        /* the diagnostic filename    */
  608. X  char ckpfile[] ="Ularn.ckp";        /* the checkpoint filename    */
  609. X--- 7,43 ----
  610. X   */
  611. X  #include "header.h"
  612. X  
  613. X+ #ifdef __MSDOS__
  614. X+ 
  615. X+ # define HOMESIZE SAVEFILENAMESIZE
  616. X+ # define HOME ""
  617. X+ 
  618. X+ #else
  619. X+ 
  620. X+ # define HOMESIZE sizeof(HOME)
  621. X+ 
  622. X+ #endif
  623. X+ 
  624. X  /* the game save filename   */
  625. X  char savefilename[SAVEFILENAMESIZE] =     HOME;
  626. X  
  627. X  /* the score file            */
  628. X! char scorefile[HOMESIZE+sizeof(SCORENAME)] =    HOME;
  629. X  
  630. X  /* the logging file        */
  631. X! char logfile[HOMESIZE+sizeof(LOGFNAME)]  =    HOME;
  632. X  
  633. X  /* the help text file    */
  634. X! char helpfile[HOMESIZE+sizeof(HELPNAME)] =    HOME;
  635. X  
  636. X  /* the maze data file    */
  637. X! char larnlevels[HOMESIZE+sizeof(LEVELSNAME)] =     HOME;
  638. X  
  639. X  /* the fortune data file */
  640. X! char fortfile[HOMESIZE+sizeof(FORTSNAME)] =    HOME;
  641. X  
  642. X  /* the .Ularnopts filename */
  643. X! char optsfile[SAVEFILENAMESIZE] ="/.Ularnopts";    /* the option file */
  644. X  
  645. X  char diagfile[] ="Diagfile";        /* the diagnostic filename    */
  646. X  char ckpfile[] ="Ularn.ckp";        /* the checkpoint filename    */
  647. Xdiff -c orig/create.c new/create.c
  648. X*** orig/create.c    Sun Jul 16 01:02:19 1989
  649. X--- new/create.c    Sun Jul 16 04:44:41 1989
  650. X***************
  651. X*** 136,142 ****
  652. X              for (i=mxl; i<mxh; i++)        
  653. X                  for (j=myl; j<myh; j++) {      
  654. X                      item[i][j]=0;
  655. X!                     if ((mitem[i][j]=z)) 
  656. X                          hitp[i][j]=monster[z].hitpoints;
  657. X                  }
  658. X          }
  659. X--- 136,142 ----
  660. X              for (i=mxl; i<mxh; i++)        
  661. X                  for (j=myl; j<myh; j++) {      
  662. X                      item[i][j]=0;
  663. X!                     if ((mitem[i][j]=z)!=0) 
  664. X                          hitp[i][j]=monster[z].hitpoints;
  665. X                  }
  666. X          }
  667. X***************
  668. X*** 219,225 ****
  669. X      register int i,j;
  670. X      int it,arg,mit,marg;
  671. X  
  672. X!     if (lopen(larnlevels)<0) {
  673. X          write(1,"Can't open the maze data file\n",30);     
  674. X          died(-282); 
  675. X          return(0);
  676. X--- 219,225 ----
  677. X      register int i,j;
  678. X      int it,arg,mit,marg;
  679. X  
  680. X!     if (lopen(larnlevels, 0)<0) {
  681. X          write(1,"Can't open the maze data file\n",30);     
  682. X          died(-282); 
  683. X          return(0);
  684. X***************
  685. X*** 630,636 ****
  686. X          if ((item[x][y]==0) && (mitem[x][y]==0) && 
  687. X                      ((playerx!=x) || (playery!=y))) {
  688. X              mitem[x][y] = what;  
  689. X!             know[x][y]=0;
  690. X              hitp[x][y] = monster[what].hitpoints;  
  691. X              return(0);
  692. X          }
  693. X--- 630,636 ----
  694. X          if ((item[x][y]==0) && (mitem[x][y]==0) && 
  695. X                      ((playerx!=x) || (playery!=y))) {
  696. X              mitem[x][y] = what;  
  697. X!             if (know[x][y]) know[x][y] = 2;
  698. X              hitp[x][y] = monster[what].hitpoints;  
  699. X              return(0);
  700. X          }
  701. Xdiff -c orig/data.c new/data.c
  702. X*** orig/data.c    Sun Jul 16 01:00:56 1989
  703. X--- new/data.c    Sun Jul 16 04:40:23 1989
  704. X***************
  705. X*** 74,87 ****
  706. X  
  707. X  char *lpbuf,*lpnt,
  708. X       *inbuffer,*lpend;  /* input/output pointers to the buffers */
  709. X- struct cel *cell;    /*    pointer to the dungeon storage    */
  710. X  short hitp[MAXX][MAXY];    /*    monster hp on level        */
  711. X  short iarg[MAXX][MAXY];    /*    arg for the item array    */
  712. X  char item[MAXX][MAXY];    /*    objects in maze if any    */
  713. X! char know[MAXX][MAXY];    /*    1 or 0 if here before    */
  714. X  char mitem[MAXX][MAXY];    /*    monster item array     */
  715. X  char moved[MAXX][MAXY];    /*    monster movement flags  */
  716. X! char stealth[MAXX][MAXY];/*  0=sleeping 1=awake monst   */
  717. X  char iven[26];        /*    inventory for player    */
  718. X  short ivenarg[26];    /*    inventory args for player    */
  719. X  char lastmonst[40];    /*this has the name of the current monster*/
  720. X--- 74,87 ----
  721. X  
  722. X  char *lpbuf,*lpnt,
  723. X       *inbuffer,*lpend;  /* input/output pointers to the buffers */
  724. X  short hitp[MAXX][MAXY];    /*    monster hp on level        */
  725. X  short iarg[MAXX][MAXY];    /*    arg for the item array    */
  726. X  char item[MAXX][MAXY];    /*    objects in maze if any    */
  727. X! char know[MAXX][MAXY];    /*    1 or 0 if here before; 2 if we know there's */
  728. X!             /*     floor here, but not what's on top */
  729. X  char mitem[MAXX][MAXY];    /*    monster item array     */
  730. X  char moved[MAXX][MAXY];    /*    monster movement flags  */
  731. X! char stealth[MAXX][MAXY];    /*  0=sleeping 1=awake monst   */
  732. X  char iven[26];        /*    inventory for player    */
  733. X  short ivenarg[26];    /*    inventory args for player    */
  734. X  char lastmonst[40];    /*this has the name of the current monster*/
  735. X***************
  736. X*** 796,798 ****
  737. X--- 796,799 ----
  738. X  char nplt[] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 4 };
  739. X  char ndgg[] = { 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5 };
  740. X  char nsw[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3 };
  741. X+ 
  742. Xdiff -c orig/diag.c new/diag.c
  743. X*** orig/diag.c    Sun Jul 16 01:02:52 1989
  744. X--- new/diag.c    Sun Jul 16 04:54:19 1989
  745. X***************
  746. X*** 2,8 ****
  747. X  #include "header.h"
  748. X  
  749. X  extern long int initialtime;
  750. X! extern int rmst,maxitm,lasttime;
  751. X  extern char nosignal;
  752. X  
  753. X  char *cdef[] = {
  754. X--- 2,8 ----
  755. X  #include "header.h"
  756. X  
  757. X  extern long int initialtime;
  758. X! extern int maxitm;
  759. X  extern char nosignal;
  760. X  
  761. X  char *cdef[] = {
  762. X***************
  763. X*** 75,81 ****
  764. X  
  765. X      fprintf(dfile, "Hit points: %2ld(%2ld)\n", c[HP], c[HPMAX]);
  766. X  
  767. X!     fprintf(dfile, "gold: %ld  Experience: %ld  Character level: %d  Level in caverns: %ld\n",
  768. X      (long) c[GOLD],
  769. X      (long) c[EXPERIENCE],
  770. X      (long) c[LEVEL],
  771. X--- 75,81 ----
  772. X  
  773. X      fprintf(dfile, "Hit points: %2ld(%2ld)\n", c[HP], c[HPMAX]);
  774. X  
  775. X!     fprintf(dfile, "gold: %ld  Experience: %ld  Character level: %ld  Level in caverns: %d\n",
  776. X      (long) c[GOLD],
  777. X      (long) c[EXPERIENCE],
  778. X      (long) c[LEVEL],
  779. X***************
  780. X*** 193,448 ****
  781. X      /* east west walls of this line    */
  782. X      for (i = 0; i < MAXY; i++) {            
  783. X          for (j = 0; j < MAXX; j++)
  784. X!             if (k = mitem[j][i])
  785. X                  fprintf(dfile, "%c", monstnamelist[k]);
  786. X              else
  787. X                  fprintf(dfile, "%c", objnamelist[item[j][i]]);
  788. X          fprintf(dfile, "\n");
  789. X      }
  790. X- }
  791. X- /*
  792. X-     to save the game in a file
  793. X-  */
  794. X- static long int zzz=0;
  795. X- savegame(fname)
  796. X- char *fname;
  797. X- {
  798. X-     register int i,k;
  799. X-     register struct sphere *sp;
  800. X-     struct stat statbuf;
  801. X- 
  802. X-     nosignal=1;  
  803. X-     lflush();    
  804. X-     savelevel();
  805. X-     ointerest();
  806. X-     if (lcreat(fname) < 0) {
  807. X-         lcreat((char*)0); 
  808. X-         lprintf("\nCan't open file <%s> to save game\n",fname);
  809. X-         nosignal=0;  
  810. X-         return(-1);
  811. X-     }
  812. X- 
  813. X-     set_score_output();
  814. X-     lwrite((char*)beenhere,MAXLEVEL+MAXVLEVEL);
  815. X-     for (k=0; k<MAXLEVEL+MAXVLEVEL; k++)
  816. X-         if (beenhere[k])
  817. X-             lwrite((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX);
  818. X-     lwrite((char*)&c[0],100*sizeof(long));
  819. X-     lprint((long)gtime);        
  820. X-     lprc(level);
  821. X-     lprc(playerx);        
  822. X-     lprc(playery);
  823. X-     lwrite((char*)iven,26);    
  824. X-     lwrite((char*)ivenarg,26*sizeof(short));
  825. X-     lwrite((char*)char_class,20);    
  826. X-     for (k=0; k<MAXSCROLL; k++)  lprc(scrollname[k][0]);
  827. X-     for (k=0; k<MAXPOTION; k++)  lprc(potionname[k][0]);
  828. X-     lwrite((char*)spelknow,SPNUM);         
  829. X-     lprc(wizard);
  830. X-     lprc(rmst);        /*    random monster generation counter */
  831. X-     for (i=0; i<90; i++)    lprc(itm[i].qty);
  832. X-     lwrite((char*)course,25);            
  833. X-     lprc(cheat);        
  834. X- 
  835. X-     /* genocide info */
  836. X-     for (i=0; i<MAXMONST; i++) lprc(monster[i].genocided);
  837. X- 
  838. X-     /* save spheres of annihilation */
  839. X-     for (sp=spheres; sp; sp=sp->p)
  840. X-         lwrite((char*)sp,sizeof(struct sphere));    
  841. X- 
  842. X-     time(&zzz);            
  843. X-     lprint((long)(zzz-initialtime));
  844. X-     lwrite((char*)&zzz,sizeof(long));
  845. X- 
  846. X-     if (fstat(lfd,&statbuf)< 0) lprint(0L);
  847. X-     else 
  848. X-         lprint((long)statbuf.st_ino); /* inode # */
  849. X- 
  850. X-     lwclose();    
  851. X-     lastmonst[0] = 0;
  852. X-     lcreat((char*)0);  
  853. X-     nosignal=0;
  854. X-     return(0);
  855. X- }
  856. X- 
  857. X- restoregame(fname)
  858. X- char *fname;
  859. X- {
  860. X-     register int i,k;
  861. X-     register struct sphere *sp,*sp2;
  862. X-     struct stat filetimes;
  863. X- 
  864. X-     cursors(); 
  865. X-     lprcat("\nRestoring . . .");  
  866. X-     lflush();
  867. X-     if (lopen(fname) <= 0) {
  868. X-         lcreat((char*)0); 
  869. X-         lprintf("\nCan't open file <%s> to restore game\n",fname);
  870. X-         nap(2000); 
  871. X-         c[GOLD]=c[BANKACCOUNT]=0;  
  872. X-         died(-265); 
  873. X-         return;
  874. X-     }
  875. X- 
  876. X-     lrfill((char*)beenhere,MAXLEVEL+MAXVLEVEL);
  877. X-     for (k=0; k<MAXLEVEL+MAXVLEVEL; k++)
  878. X-         if (beenhere[k])
  879. X-             lrfill((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX);
  880. X- 
  881. X-     lrfill((char*)&c[0],100*sizeof(long));    
  882. X-     gtime = lrint();
  883. X-     level = c[CAVELEVEL] = lgetc();
  884. X- 
  885. X-     playerx = lgetc();        
  886. X-     playery = lgetc();
  887. X- 
  888. X-     lrfill((char*)iven,26);
  889. X-     lrfill((char*)ivenarg,26*sizeof(short));
  890. X-     lrfill((char*)char_class,20);        
  891. X- 
  892. X-     for (k=0; k<MAXSCROLL; k++)  scrollname[k][0] = lgetc();
  893. X-     for (k=0; k<MAXPOTION; k++)  potionname[k][0] = lgetc();
  894. X- 
  895. X-     lrfill((char*)spelknow,SPNUM);        
  896. X- 
  897. X-     wizard = lgetc();
  898. X-     rmst = lgetc();            /*    random monster creation flag */
  899. X- 
  900. X-     for (i=0; i<90; i++)    
  901. X-         itm[i].qty = lgetc();
  902. X- 
  903. X-     lrfill((char*)course,25);            
  904. X-     cheat = lgetc();
  905. X- 
  906. X-     /* genocide info */
  907. X-     for (i=0; i<MAXMONST; i++) monster[i].genocided=lgetc(); 
  908. X- 
  909. X-     for (sp=0,i=0; i<c[SPHCAST]; i++) {
  910. X-         sp2 = sp;
  911. X-         sp = (struct sphere *)malloc(sizeof(struct sphere));
  912. X-         if (sp==0) { 
  913. X-             fprintf(stderr, "Can't malloc() for sphere space\n"); 
  914. X-             break; 
  915. X-         }
  916. X-         /* get spheres of annihilation */
  917. X-         lrfill((char*)sp,sizeof(struct sphere));    
  918. X-         sp->p=0;    /* null out pointer */
  919. X-         if (i==0) spheres=sp;    /* beginning of list */
  920. X-         else sp2->p = sp;
  921. X-     }
  922. X- 
  923. X- 
  924. X-     time(&zzz);
  925. X-     initialtime = zzz-lrint();
  926. X- 
  927. X-     fstat(fd,&filetimes);/*get the creation and modification time of file*/
  928. X- 
  929. X-     lrfill((char*)&zzz,sizeof(long));    
  930. X- 
  931. X-     zzz += 6;
  932. X-     if (filetimes.st_ctime > zzz) 
  933. X-         fsorry();    /*file create time    */
  934. X-     else if (filetimes.st_mtime > zzz) 
  935. X-         fsorry(); /*    file modify time*/
  936. X- 
  937. X- 
  938. X-     if (c[HP]<0) { 
  939. X-         died(284); 
  940. X-         return; 
  941. X-     }    /* died a post mortem death */
  942. X- 
  943. X-     oldx = oldy = 0;
  944. X- 
  945. X-     i = lrint();  /* inode # */
  946. X-     if (i && (filetimes.st_ino!=i)) 
  947. X-         fsorry();    /* different inode number, file was copied */
  948. X- 
  949. X-     lrclose();
  950. X- 
  951. X-     if (strcmp(fname,ckpfile) == 0) {
  952. X-         if (lappend(fname) < 0) 
  953. X-             fcheat();  
  954. X-         else { 
  955. X-             lprc(' '); 
  956. X-             lwclose(); 
  957. X-         }
  958. X-         lcreat((char*)0);
  959. X-     }
  960. X-     else if (unlink(fname) < 0) 
  961. X-         fcheat(); /* can't unlink save file */
  962. X- 
  963. X-     /*    for the greedy cheater checker    */
  964. X-     /* for (k=0; k<6; k++) if (c[k]>99) greedy();
  965. X-     if (c[HPMAX]>999 || c[SPELLMAX]>125) greedy(); */
  966. X-     if (c[LEVEL]==25 && c[EXPERIENCE]>skill[24]) {
  967. X-         long tmp = c[EXPERIENCE]-skill[24]; /* amount to go up */
  968. X-         c[EXPERIENCE] = skill[24];
  969. X-         raiseexperience((long)tmp);
  970. X-     }
  971. X-     getlevel();  
  972. X-     lasttime=gtime;
  973. X- 
  974. X-     for (k=0; k<26; k++) 
  975. X-         if (iven[k] == OLARNEYE) {
  976. X-             monstnamelist[DEMONLORD] = '1';
  977. X-             monstnamelist[DEMONLORD+1] = '2';
  978. X-             monstnamelist[DEMONLORD+2] = '3';
  979. X-             monstnamelist[DEMONLORD+3] = '4';
  980. X-             monstnamelist[DEMONLORD+4] = '5';
  981. X-             monstnamelist[DEMONLORD+5] = '6';
  982. X-             monstnamelist[DEMONLORD+6] = '7';
  983. X-             monstnamelist[DEMONPRINCE] = '9';
  984. X-             monstnamelist[LUCIFER] = '0';
  985. X-             break;
  986. X-         }
  987. X- }
  988. X- 
  989. X- /*
  990. X-     subroutine to not allow greedy cheaters
  991. X-  */
  992. X- greedy()
  993. X- {
  994. X-     if (wizard) return;
  995. X- 
  996. X- lprcat("\n\nI am so sorry, but your character is a little TOO good!  Since this\n");
  997. X- lprcat("cannot normally happen from an honest game, I must assume that you cheated.\n");
  998. X- lprcat("In that you are GREEDY as well as a CHEATER, I cannot allow this game\n");
  999. X-     lprcat("to continue.\n"); 
  1000. X-     nap(5000);  
  1001. X-     c[GOLD]=c[BANKACCOUNT]=0;  
  1002. X-     died(-267); 
  1003. X-     return;
  1004. X- }
  1005. X- 
  1006. X- /*
  1007. X-     subroutine to not allow altered save files and terminate the attempted
  1008. X-     restart
  1009. X-  */
  1010. X- fsorry()
  1011. X- {
  1012. X-     if(cheat) return;
  1013. X- lprcat("\nSorry, but your savefile has been altered.\n");
  1014. X- lprcat("However, seeing as I am a good sport, I will let you play.\n");
  1015. X- lprcat("Be advised though, you won't be placed on the scoreboard.");
  1016. X-     cheat = 1;    
  1017. X-     nap(4000);
  1018. X- }
  1019. X- 
  1020. X- /*
  1021. X-     subroutine to not allow game if save file can't be deleted
  1022. X-  */
  1023. X- fcheat()
  1024. X- {
  1025. X-     if (wizard) return;
  1026. X-     if(cheat) return;
  1027. X- 
  1028. X- lprcat("\nSorry, but your savefile can't be deleted.  This can only mean\n");
  1029. X- lprcat("that you tried to CHEAT by protecting the directory the savefile\n");
  1030. X- lprcat("is in.  Since this is unfair to the rest of the Ularn community, I\n");
  1031. X- lprcat("cannot let you play this game.\n");
  1032. X-     nap(5000);  
  1033. X-     c[GOLD]=c[BANKACCOUNT]=0;  
  1034. X-     died(-268); 
  1035. X-     return;
  1036. X  }
  1037. X--- 193,202 ----
  1038. X      /* east west walls of this line    */
  1039. X      for (i = 0; i < MAXY; i++) {            
  1040. X          for (j = 0; j < MAXX; j++)
  1041. X!             if ((k = mitem[j][i])!=0)
  1042. X                  fprintf(dfile, "%c", monstnamelist[k]);
  1043. X              else
  1044. X                  fprintf(dfile, "%c", objnamelist[item[j][i]]);
  1045. X          fprintf(dfile, "\n");
  1046. X      }
  1047. X  }
  1048. Xdiff -c orig/display.c new/display.c
  1049. X*** orig/display.c    Sun Jul 16 01:02:58 1989
  1050. X--- new/display.c    Sun Jul 16 04:46:58 1989
  1051. X***************
  1052. X*** 1,7 ****
  1053. X  /*    display.c */
  1054. X  #include "header.h"
  1055. X  
  1056. X! #define makecode(_a,_b,_c) (((_a)<<16) + ((_b)<<8) + (_c))
  1057. X  
  1058. X  static int minx,maxx,miny,maxy,k,m;
  1059. X  static char bot1f=0,bot2f=0,bot3f=0;
  1060. X--- 1,7 ----
  1061. X  /*    display.c */
  1062. X  #include "header.h"
  1063. X  
  1064. X! #define makecode(_a,_b,_c) (((long)(_a)<<16) + ((_b)<<8) + (_c))
  1065. X  
  1066. X  static int minx,maxx,miny,maxy,k,m;
  1067. X  static char bot1f=0,bot2f=0,bot3f=0;
  1068. X***************
  1069. X*** 200,206 ****
  1070. X  }
  1071. X  
  1072. X  botsub(idx,str)
  1073. X! register int idx;
  1074. X  char *str;
  1075. X  {
  1076. X      register int x,y;
  1077. X--- 200,206 ----
  1078. X  }
  1079. X  
  1080. X  botsub(idx,str)
  1081. X! register long idx;
  1082. X  char *str;
  1083. X  {
  1084. X      register int x,y;
  1085. X***************
  1086. X*** 274,281 ****
  1087. X      for (i=d_ymin; i<d_ymax; i++)
  1088. X          for (j=d_xmin; j<d_xmax; j++)
  1089. X              if (know[j][i]==0)  screen[j][i] = ' ';  
  1090. X              else
  1091. X!                 if (k=mitem[j][i])  {
  1092. X                    if (k==MIMIC)
  1093. X                      screen[j][i] = 
  1094. X                          monstnamelist[rund(MAXMONST)];
  1095. X--- 274,283 ----
  1096. X      for (i=d_ymin; i<d_ymax; i++)
  1097. X          for (j=d_xmin; j<d_xmax; j++)
  1098. X              if (know[j][i]==0)  screen[j][i] = ' ';  
  1099. X+             else if (know[j][i]==2)
  1100. X+                 screen[j][i] = objnamelist[0];
  1101. X              else
  1102. X!                 if ((k=mitem[j][i])!=0)  {
  1103. X                    if (k==MIMIC)
  1104. X                      screen[j][i] = 
  1105. X                          monstnamelist[rund(MAXMONST)];
  1106. X***************
  1107. X*** 284,291 ****
  1108. X                  }
  1109. X              else
  1110. X                  if ((k=item[j][i])==OWALL) 
  1111. X!                     screen[j][i] = '#';
  1112. X!                     else screen[j][i] = ' ';
  1113. X  
  1114. X      for (i=d_ymin; i<d_ymax; i++) {
  1115. X          j=d_xmin;  
  1116. X--- 286,294 ----
  1117. X                  }
  1118. X              else
  1119. X                  if ((k=item[j][i])==OWALL) 
  1120. X!                     screen[j][i] = objnamelist[OWALL];
  1121. X!                 else
  1122. X!                     screen[j][i] = objnamelist[0];
  1123. X  
  1124. X      for (i=d_ymin; i<d_ymax; i++) {
  1125. X          j=d_xmin;  
  1126. X***************
  1127. X*** 316,325 ****
  1128. X  
  1129. X      for (lastx=lasty=127, i=d_ymin; i<d_ymax; i++)
  1130. X        for (j=d_xmin; j<d_xmax; j++) {
  1131. X!         if (k=item[j][i])
  1132. X              if (k != OWALL)
  1133. X                  if ((know[j][i]) && (mitem[j][i]==0))
  1134. X!                     if (objnamelist[k]!=' ') {
  1135. X                          if (lasty!=i+1 || lastx!=j)
  1136. X                             cursor(lastx=j+1,lasty=i+1);
  1137. X                          else lastx++;
  1138. X--- 319,328 ----
  1139. X  
  1140. X      for (lastx=lasty=127, i=d_ymin; i<d_ymax; i++)
  1141. X        for (j=d_xmin; j<d_xmax; j++) {
  1142. X!         if ((k=item[j][i])!=0)
  1143. X              if (k != OWALL)
  1144. X                  if ((know[j][i]) && (mitem[j][i]==0))
  1145. X!                     if (objnamelist[k]!=objnamelist[0]) {
  1146. X                          if (lasty!=i+1 || lastx!=j)
  1147. X                             cursor(lastx=j+1,lasty=i+1);
  1148. X                          else lastx++;
  1149. X***************
  1150. X*** 370,379 ****
  1151. X  
  1152. X      for (j=miny; j<=maxy; j++)
  1153. X          for (m=minx; m<=maxx; m++)
  1154. X!             if (know[m][j]==0) {
  1155. X                  cursor(m+1,j+1);
  1156. X                  x=maxx;  
  1157. X!                 while (know[x][j]) --x;
  1158. X                  for (i=m; i<=x; i++) {
  1159. X                    if ((k=mitem[i][j]) != 0) {
  1160. X                      if (k==MIMIC)
  1161. X--- 373,382 ----
  1162. X  
  1163. X      for (j=miny; j<=maxy; j++)
  1164. X          for (m=minx; m<=maxx; m++)
  1165. X!             if ((know[m][j] & 1)==0) {
  1166. X                  cursor(m+1,j+1);
  1167. X                  x=maxx;  
  1168. X!                 while (know[x][j] & 1) --x;
  1169. X                  for (i=m; i<=x; i++) {
  1170. X                    if ((k=mitem[i][j]) != 0) {
  1171. X                      if (k==MIMIC)
  1172. Xdiff -c orig/fortune.c new/fortune.c
  1173. X*** orig/fortune.c    Sun Jul 16 01:03:01 1989
  1174. X--- new/fortune.c    Sun Jul 16 04:58:04 1989
  1175. X***************
  1176. X*** 31,37 ****
  1177. X          }
  1178. X  
  1179. X          /* read in the entire fortune file */
  1180. X!         if (read(fd,base,stat.st_size) != stat.st_size) {
  1181. X              close(fd); 
  1182. X              fd= -1; 
  1183. X              free((char*)base); 
  1184. X--- 31,37 ----
  1185. X          }
  1186. X  
  1187. X          /* read in the entire fortune file */
  1188. X!         if ((stat.st_size = read(fd,base,stat.st_size)) == -1) {
  1189. X              close(fd); 
  1190. X              fd= -1; 
  1191. X              free((char*)base); 
  1192. Xdiff -c orig/global.c new/global.c
  1193. X*** orig/global.c    Sun Jul 16 01:02:28 1989
  1194. X--- new/global.c    Sun Jul 16 04:46:04 1989
  1195. X***************
  1196. X*** 300,309 ****
  1197. X  
  1198. X      if (lev < 5) 
  1199. X          while (tmp==WATERLORD) 
  1200. X!             tmp=rnd((x=monstlevel[lev-1])?x:1);
  1201. X  
  1202. X      else while (tmp==WATERLORD)
  1203. X!         tmp=rnd((x=monstlevel[lev-1]-monstlevel[lev-4])?x:1)+monstlevel[lev-4];
  1204. X  
  1205. X      while (monster[tmp].genocided && tmp<MAXMONST) tmp++; /* genocided? */
  1206. X  
  1207. X--- 300,310 ----
  1208. X  
  1209. X      if (lev < 5) 
  1210. X          while (tmp==WATERLORD) 
  1211. X!             tmp=rnd(((x=monstlevel[lev-1])!=0)?x:1);
  1212. X  
  1213. X      else while (tmp==WATERLORD)
  1214. X!         tmp=rnd(((x=monstlevel[lev-1]-monstlevel[lev-4])!=0)?x:1)
  1215. X!             +monstlevel[lev-4];
  1216. X  
  1217. X      while (monster[tmp].genocided && tmp<MAXMONST) tmp++; /* genocided? */
  1218. X  
  1219. X***************
  1220. X*** 858,875 ****
  1221. X      case OLANCE:            
  1222. X          c[LANCEDEATH]=0;    
  1223. X          return;
  1224. X!     case OLARNEYE:
  1225. X!         monstnamelist[DEMONLORD] = ' ';
  1226. X!         monstnamelist[DEMONLORD+1] = ' ';
  1227. X!         monstnamelist[DEMONLORD+2] = ' ';
  1228. X!         monstnamelist[DEMONLORD+3] = ' ';
  1229. X!         monstnamelist[DEMONLORD+4] = ' ';
  1230. X!         monstnamelist[DEMONLORD+5] = ' ';
  1231. X!         monstnamelist[DEMONLORD+6] = ' ';
  1232. X!         monstnamelist[DEMONPRINCE] = ' ';
  1233. X!         monstnamelist[LUCIFER] = ' ';
  1234. X          cursors();
  1235. X          return;
  1236. X      case OPOTION:    
  1237. X      case OSCROLL:    
  1238. X          return;
  1239. X--- 859,878 ----
  1240. X      case OLANCE:            
  1241. X          c[LANCEDEATH]=0;    
  1242. X          return;
  1243. X!     case OLARNEYE: {
  1244. X!         char c = objnamelist[0];
  1245. X!         monstnamelist[DEMONLORD  ] = c;
  1246. X!         monstnamelist[DEMONLORD+1] = c;
  1247. X!         monstnamelist[DEMONLORD+2] = c;
  1248. X!         monstnamelist[DEMONLORD+3] = c;
  1249. X!         monstnamelist[DEMONLORD+4] = c;
  1250. X!         monstnamelist[DEMONLORD+5] = c;
  1251. X!         monstnamelist[DEMONLORD+6] = c;
  1252. X!         monstnamelist[DEMONPRINCE] = c;
  1253. X!         monstnamelist[LUCIFER]     = c;
  1254. X          cursors();
  1255. X          return;
  1256. X+         }
  1257. X      case OPOTION:    
  1258. X      case OSCROLL:    
  1259. X          return;
  1260. Xdiff -c orig/header.h new/header.h
  1261. X*** orig/header.h    Sun Jul 16 01:06:56 1989
  1262. X--- new/header.h    Sun Jul 16 06:14:28 1989
  1263. X***************
  1264. X*** 2,20 ****
  1265. X  #include <sys/types.h>
  1266. X  #include <sys/stat.h>
  1267. X  
  1268. X! #ifdef BSD
  1269. X  #    include <sys/timeb.h>
  1270. X  #    include <sys/time.h>
  1271. X  #    include <sgtty.h>
  1272. X! #else
  1273. X  #    include <sys/times.h>
  1274. X  #    include <termio.h>
  1275. X! #endif
  1276. X  
  1277. X  #include <fcntl.h>
  1278. X  #include <ctype.h>
  1279. X! #include <varargs.h>
  1280. X! #include <pwd.h>
  1281. X  #include <signal.h>
  1282. X  #include <stdio.h>
  1283. X  
  1284. X--- 2,26 ----
  1285. X  #include <sys/types.h>
  1286. X  #include <sys/stat.h>
  1287. X  
  1288. X! #ifndef __MSDOS__
  1289. X! # include <pwd.h>
  1290. X! # ifdef BSD
  1291. X  #    include <sys/timeb.h>
  1292. X  #    include <sys/time.h>
  1293. X  #    include <sgtty.h>
  1294. X! # else
  1295. X  #    include <sys/times.h>
  1296. X  #    include <termio.h>
  1297. X! # endif
  1298. X! #endif /* __MSDOS__ */
  1299. X  
  1300. X  #include <fcntl.h>
  1301. X  #include <ctype.h>
  1302. X! #ifdef __TURBOC__
  1303. X! # include <stdarg.h>
  1304. X! #else
  1305. X! # include <varargs.h>
  1306. X! #endif
  1307. X  #include <signal.h>
  1308. X  #include <stdio.h>
  1309. X  
  1310. X***************
  1311. X*** 69,84 ****
  1312. X      char    qty;
  1313. X  };
  1314. X  
  1315. X- /*    this is the structure that holds the entire dungeon specifications    */
  1316. X- struct cel
  1317. X- {
  1318. X-     short    hitp;    /*    monster's hit points    */
  1319. X-     char    mitem;    /*    the monster ID        */
  1320. X-     char    item;    /*    the object's ID        */
  1321. X-     short    iarg;    /*    the object's argument    */
  1322. X-     char    know;    /*    have we been here before*/
  1323. X- };
  1324. X- 
  1325. X  /* this is the structure for maintaining & moving the spheres of annihilation */
  1326. X  struct sphere
  1327. X  {
  1328. X--- 75,80 ----
  1329. X***************
  1330. X*** 397,403 ****
  1331. X  extern int dayplay,enable_scroll,srcount,stayflag,yrepcount,userid,lfd,fd;
  1332. X  extern long initialtime,outstanding_taxes,skill[],gtime,c[],cbak[];
  1333. X  extern unsigned long randx;
  1334. X- extern struct cel *cell;
  1335. X  extern struct monst monster[];
  1336. X  extern struct sphere *spheres;
  1337. X  extern struct _itm itm[];
  1338. X--- 393,398 ----
  1339. X***************
  1340. X*** 454,461 ****
  1341. X      /* macro to seed the random number generator */
  1342. X  #define srand(x) (randx=x)
  1343. X      /* macros to generate random numbers   1<=rnd(N)<=N   0<=rund(N)<=N-1 */
  1344. X! #define rnd(x)  ((((randx=randx*1103515245+12345)>>7)%(x))+1)
  1345. X! #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)))
  1346. X      /* macros for miscellaneous data conversion */
  1347. X  #define min(x,y) (((x)>(y))?(y):(x))
  1348. X  #define max(x,y) (((x)>(y))?(x):(y))
  1349. X--- 449,458 ----
  1350. X      /* macro to seed the random number generator */
  1351. X  #define srand(x) (randx=x)
  1352. X      /* macros to generate random numbers   1<=rnd(N)<=N   0<=rund(N)<=N-1 */
  1353. X! #define rnd(x)  ((int)((((randx=randx*1103515245+12345)>>7)%(x))+1))
  1354. X! #define rund(x) ((int)((((randx=randx*1103515245+12345)>>7)%(x))))
  1355. X! #define rndl(x)  ((((randx=randx*1103515245+12345)>>7)%(x))+1)
  1356. X! #define rundl(x) ((((randx=randx*1103515245+12345)>>7)%(x)))
  1357. X      /* macros for miscellaneous data conversion */
  1358. X  #define min(x,y) (((x)>(y))?(y):(x))
  1359. X  #define max(x,y) (((x)>(y))?(x):(y))
  1360. Xdiff -c orig/help.c new/help.c
  1361. X*** orig/help.c    Sun Jul 16 01:01:55 1989
  1362. X--- new/help.c    Sun Jul 16 04:54:28 1989
  1363. X***************
  1364. X*** 86,92 ****
  1365. X   */
  1366. X  openhelp()
  1367. X  {
  1368. X!     if (lopen(helpfile)<0) {
  1369. X          lprintf("Can't open help file \"%s\" ",helpfile);
  1370. X          lflush(); 
  1371. X          sleep(4);    
  1372. X--- 86,92 ----
  1373. X   */
  1374. X  openhelp()
  1375. X  {
  1376. X!     if (lopen(helpfile, 0)<0) {
  1377. X          lprintf("Can't open help file \"%s\" ",helpfile);
  1378. X          lflush(); 
  1379. X          sleep(4);    
  1380. Xdiff -c orig/io.c new/io.c
  1381. X*** orig/io.c    Sun Jul 16 01:01:07 1989
  1382. X--- new/io.c    Sun Jul 16 04:37:38 1989
  1383. X***************
  1384. X*** 30,38 ****
  1385. X   *
  1386. X   *    FILE OPEN / CLOSE ROUTINES
  1387. X   *
  1388. X!  *    lcreat(filename)        create a new file for write
  1389. X!  *    lopen(filename)            open a file for read
  1390. X!  *    lappend(filename)        open for append to an existing file
  1391. X   *    lrclose()            close the input file
  1392. X   *    lwclose()            close output file
  1393. X   *    lflush()            flush the output buffer
  1394. X--- 30,38 ----
  1395. X   *
  1396. X   *    FILE OPEN / CLOSE ROUTINES
  1397. X   *
  1398. X!  *    lcreat(filename, mode)        create a new file for write
  1399. X!  *    lopen(filename, mode)        open a file for read
  1400. X!  *    lappend(filename, mode)        open for append to an existing file
  1401. X   *    lrclose()            close the input file
  1402. X   *    lwclose()            close output file
  1403. X   *    lflush()            flush the output buffer
  1404. X***************
  1405. X*** 55,71 ****
  1406. X   * Note: ** entries are available only in termcap mode.
  1407. X   */
  1408. X  #include "header.h"
  1409. X  
  1410. X! #ifdef BSD
  1411. X  #    define    GTTY(arg)    (ioctl(0, TIOCGETP, arg))
  1412. X  #    define    STTY(arg)    (ioctl(0, TIOCSETP, arg))
  1413. X      static struct sgttyb inittyb, curttyb;
  1414. X! #else /* SYSV */
  1415. X  #    define GTTY(arg)        (ioctl(0, TCGETA, arg))
  1416. X  #    define STTY(arg)        (ioctl(0, TCSETAW, arg))
  1417. X  #    define SPEED(x)    ((x).c_cflag & CBAUD)
  1418. X      static struct termio inittyb, curttyb;
  1419. X! #endif /* BSD */
  1420. X  
  1421. X  #define    ON    1
  1422. X  #define OFF    0
  1423. X--- 55,84 ----
  1424. X   * Note: ** entries are available only in termcap mode.
  1425. X   */
  1426. X  #include "header.h"
  1427. X+ #ifdef __MSDOS__
  1428. X+ # include <dos.h>
  1429. X  
  1430. X! static short inittyb, curttyb;
  1431. X! # define GTTY(arg) (-((*(arg)=(ioctl(0, 0, arg)&0xff)) == ((-1)&0xff)))
  1432. X! # define STTY(arg) (-(ioctl(0, 1, (int *)(*(arg)))==-1))
  1433. X! 
  1434. X! int keypad=0, rawio=0, nansi=0;
  1435. X! int fg_color = 7, bg_color = 0;
  1436. X! static int echo = 1;
  1437. X! 
  1438. X! #else /* __MSDOS__ */
  1439. X! 
  1440. X! #  ifdef BSD
  1441. X  #    define    GTTY(arg)    (ioctl(0, TIOCGETP, arg))
  1442. X  #    define    STTY(arg)    (ioctl(0, TIOCSETP, arg))
  1443. X      static struct sgttyb inittyb, curttyb;
  1444. X! #  else /* SYSV */
  1445. X  #    define GTTY(arg)        (ioctl(0, TCGETA, arg))
  1446. X  #    define STTY(arg)        (ioctl(0, TCSETAW, arg))
  1447. X  #    define SPEED(x)    ((x).c_cflag & CBAUD)
  1448. X      static struct termio inittyb, curttyb;
  1449. X! #  endif /* BSD */
  1450. X! #endif /* __MSDOS__ */
  1451. X  
  1452. X  #define    ON    1
  1453. X  #define OFF    0
  1454. X***************
  1455. X*** 117,122 ****
  1456. X--- 130,136 ----
  1457. X      }
  1458. X      curttyb = inittyb;
  1459. X  #ifndef BSD
  1460. X+ # ifndef __MSDOS__
  1461. X      ospeed = SPEED(inittyb);
  1462. X      /* do not expand tabs - they might be needed inside a cm sequence */
  1463. X      if(curttyb.c_oflag & TAB3) {
  1464. X***************
  1465. X*** 123,128 ****
  1466. X--- 137,143 ----
  1467. X          curttyb.c_oflag &= ~TAB3;
  1468. X          setctty();
  1469. X      }
  1470. X+ # endif /* __MSDOS__ */
  1471. X  #endif /* BSD */
  1472. X      setuptty();
  1473. X  }
  1474. X***************
  1475. X*** 158,167 ****
  1476. X  **    function to setup all required terminal modes for game
  1477. X  */
  1478. X  setuptty(){
  1479. X-     int change = 0;
  1480. X  #ifdef BSD
  1481. X      scbr();
  1482. X! #else /* SYSV */
  1483. X      if((curttyb.c_lflag & ECHO) != OFF){
  1484. X          curttyb.c_lflag &= ~ECHO;
  1485. X          change++;
  1486. X--- 173,183 ----
  1487. X  **    function to setup all required terminal modes for game
  1488. X  */
  1489. X  setuptty(){
  1490. X  #ifdef BSD
  1491. X      scbr();
  1492. X! #else
  1493. X! # ifdef SYSV
  1494. X!     int change = 0;
  1495. X      if((curttyb.c_lflag & ECHO) != OFF){
  1496. X          curttyb.c_lflag &= ~ECHO;
  1497. X          change++;
  1498. X***************
  1499. X*** 176,181 ****
  1500. X--- 192,204 ----
  1501. X      }
  1502. X      if(change)
  1503. X          setctty();
  1504. X+ # else /* __MSDOS__ */
  1505. X+     scbr();
  1506. X+     if (rawio) {
  1507. X+     curttyb |= 0x20;
  1508. X+         setctty();
  1509. X+     }
  1510. X+ # endif
  1511. X  #endif /* BSD */
  1512. X  }
  1513. X  
  1514. X***************
  1515. X*** 186,199 ****
  1516. X   */
  1517. X  scbr()
  1518. X  {
  1519. X! #ifdef BSD
  1520. X      curttyb.sg_flags |= CBREAK;
  1521. X      curttyb.sg_flags &= ~ECHO;
  1522. X! #else /* SYSV */
  1523. X      curttyb.c_lflag &= ~ECHO;
  1524. X      curttyb.c_lflag &= ~ICANON;
  1525. X! #endif /* BSD */
  1526. X      setctty();
  1527. X  }
  1528. X  
  1529. X  /*
  1530. X--- 209,226 ----
  1531. X   */
  1532. X  scbr()
  1533. X  {
  1534. X! #ifdef __MSDOS__
  1535. X!     echo = 0;
  1536. X! #else
  1537. X! # ifdef BSD
  1538. X      curttyb.sg_flags |= CBREAK;
  1539. X      curttyb.sg_flags &= ~ECHO;
  1540. X! # else /* SYSV */
  1541. X      curttyb.c_lflag &= ~ECHO;
  1542. X      curttyb.c_lflag &= ~ICANON;
  1543. X! # endif /* BSD */
  1544. X      setctty();
  1545. X+ #endif /* __MSDOS__ */
  1546. X  }
  1547. X  
  1548. X  /*
  1549. X***************
  1550. X*** 203,216 ****
  1551. X   */
  1552. X  sncbr()
  1553. X  {
  1554. X! #ifdef BSD
  1555. X       curttyb.sg_flags &= ~CBREAK;
  1556. X      curttyb.sg_flags |= ECHO;
  1557. X! #else /* SYSV */
  1558. X      curttyb.c_lflag |= ECHO;
  1559. X      curttyb.c_lflag |= ICANON;
  1560. X! #endif /* BSD */
  1561. X      setctty();
  1562. X  }
  1563. X  
  1564. X  /*
  1565. X--- 230,247 ----
  1566. X   */
  1567. X  sncbr()
  1568. X  {
  1569. X! #ifdef __MSDOS__
  1570. X!     echo = 1;
  1571. X! #else
  1572. X! # ifdef BSD
  1573. X       curttyb.sg_flags &= ~CBREAK;
  1574. X      curttyb.sg_flags |= ECHO;
  1575. X! # else /* SYSV */
  1576. X      curttyb.c_lflag |= ECHO;
  1577. X      curttyb.c_lflag |= ICANON;
  1578. X! # endif /* BSD */
  1579. X      setctty();
  1580. X+ #endif /* not __MSDOS__ */
  1581. X  }
  1582. X  
  1583. X  /*
  1584. X***************
  1585. X*** 220,227 ****
  1586. X--- 251,291 ----
  1587. X  {
  1588. X      char byt;
  1589. X  
  1590. X+ #ifdef __MSDOS__
  1591. X+ static int kpd_trans[] = {
  1592. X+     'y', 'k', 'u', -1,
  1593. X+     'h', '.', 'l', -1,
  1594. X+     'b', 'j', 'n',
  1595. X+     'i', '.',
  1596. X+ };
  1597. X+ static int kpd_shift_trans[] = {
  1598. X+     'i', 'B', 'J', 'N', 'H', '.', 'L', 'Y', 'K', 'U',
  1599. X+ };
  1600. X+ 
  1601. X      lflush();        /* be sure output buffer is flushed */
  1602. X+ try_again:
  1603. X+     byt = echo ? getche() : getch();
  1604. X+     if (byt == '\r') byt = '\n';
  1605. X+     if (echo) return byt;
  1606. X+     if (keypad && byt == '\0') { /* translate extended scan codes */
  1607. X+         byt = getch();
  1608. X+         if (byt < 71 || byt >= 71 + sizeof(kpd_trans)/sizeof(kpd_trans[0]))
  1609. X+             goto try_again;
  1610. X+         byt = kpd_trans[byt-71];
  1611. X+         if (byt == -1) goto try_again;
  1612. X+     }
  1613. X+     else if (keypad && isdigit(byt)) {
  1614. X+         union REGS regs;
  1615. X+         regs.h.ah = 2;
  1616. X+         int86(0x16, ®s, ®s);  /* get shift state */
  1617. X+         if (regs.h.al & 0x03)  /* is either shift key down? */
  1618. X+             byt = kpd_shift_trans[byt-'0'];
  1619. X+         }
  1620. X+ 
  1621. X+ #else
  1622. X+     lflush();        /* be sure output buffer is flushed */
  1623. X      read(0,&byt,1);     /* get byte from terminal */
  1624. X+ #endif
  1625. X      return(byt);
  1626. X  }
  1627. X  
  1628. X***************
  1629. X*** 254,270 ****
  1630. X--- 318,347 ----
  1631. X   *    Returns nothing of value.
  1632. X   */
  1633. X  /*VARARGS*/
  1634. X+ #ifdef __TURBOC__
  1635. X+ lprintf(char *fmt, ...)
  1636. X+ #else
  1637. X  lprintf(va_alist)
  1638. X  va_dcl
  1639. X+ #endif
  1640. X  {
  1641. X      va_list ap;    /* pointer for variable argument list */
  1642. X+ #ifndef __TURBOC__
  1643. X      char *fmt;
  1644. X+ #endif
  1645. X      char *outb,*tmpb;
  1646. X      long wide,left,cont,n;        /* data for lprintf    */
  1647. X      char db[12];            /* %d buffer in lprintf    */
  1648. X  
  1649. X+ #ifdef __TURBOC__
  1650. X+     va_start(ap, fmt); /* initialize the varargs pointer */
  1651. X+ #else
  1652. X      va_start(ap);    /* initialize the var args pointer */
  1653. X+ #endif
  1654. X+ 
  1655. X+ #ifndef __TURBOC__        
  1656. X      fmt = va_arg(ap, char *);    /* pointer to format string */
  1657. X+ #endif
  1658. X      if (lpnt >= lpend) lflush(); 
  1659. X      outb = lpnt;
  1660. X      for ( ; ; ) {
  1661. X***************
  1662. X*** 310,316 ****
  1663. X              case 's':    
  1664. X                  tmpb = va_arg(ap, char *);
  1665. X                  if (wide==0)  { 
  1666. X!                     while (*outb++ = *tmpb++);  
  1667. X                      --outb; 
  1668. X                  } 
  1669. X                  else {
  1670. X--- 387,393 ----
  1671. X              case 's':    
  1672. X                  tmpb = va_arg(ap, char *);
  1673. X                  if (wide==0)  { 
  1674. X!                     while ((*outb++ = *tmpb++)!=0);  
  1675. X                      --outb; 
  1676. X                  } 
  1677. X                  else {
  1678. X***************
  1679. X*** 318,324 ****
  1680. X                      if (left)  
  1681. X                          while (n-- > 0) 
  1682. X                              *outb++ = ' ';
  1683. X!                     while (*outb++ = *tmpb++)
  1684. X                          ;  
  1685. X                      --outb;
  1686. X                      if (left==0)  
  1687. X--- 395,401 ----
  1688. X                      if (left)  
  1689. X                          while (n-- > 0) 
  1690. X                              *outb++ = ' ';
  1691. X!                     while ((*outb++ = *tmpb++)!=0)
  1692. X                          ;  
  1693. X                      --outb;
  1694. X                      if (left==0)  
  1695. X***************
  1696. X*** 437,444 ****
  1697. X  
  1698. X      if (ipoint != iepoint)  
  1699. X          return(inbuffer[ipoint++]);
  1700. X-     if (iepoint!=MAXIBUF)   
  1701. X-         return(0);
  1702. X      if ((i=read(fd,inbuffer,MAXIBUF))<=0) {
  1703. X          if (i!=0)  
  1704. X              fprintf(stderr,"error reading from input file\n");
  1705. X--- 514,519 ----
  1706. X***************
  1707. X*** 567,585 ****
  1708. X  }
  1709. X  
  1710. X  /*
  1711. X!  *    lcreat(filename)            Create a new file for write
  1712. X   *        char *filename;
  1713. X   *
  1714. X   *    lcreat((char*)0); means to the terminal
  1715. X   *    Returns -1 if error, otherwise the file descriptor opened.
  1716. X   */
  1717. X! lcreat(str)
  1718. X  char *str;
  1719. X  {
  1720. X      lpnt = lpbuf;    
  1721. X      lpend = lpbuf+BUFBIG;
  1722. X      if (str==0) return(lfd=1);
  1723. X!     if ((lfd=creat(str,0644)) < 0) {
  1724. X          lfd=1; 
  1725. X          lprintf("error creating file <%s>\n",str); 
  1726. X          lflush(); 
  1727. X--- 642,668 ----
  1728. X  }
  1729. X  
  1730. X  /*
  1731. X!  *    lcreat(filename, mode)            Create a new file for write
  1732. X   *        char *filename;
  1733. X+  *        int mode;
  1734. X   *
  1735. X+  *    mode is 0 for text files and 1 for binary files.
  1736. X   *    lcreat((char*)0); means to the terminal
  1737. X   *    Returns -1 if error, otherwise the file descriptor opened.
  1738. X   */
  1739. X! lcreat(str, mode)
  1740. X  char *str;
  1741. X+ int mode;
  1742. X  {
  1743. X      lpnt = lpbuf;    
  1744. X      lpend = lpbuf+BUFBIG;
  1745. X      if (str==0) return(lfd=1);
  1746. X! #ifdef __MSDOS__
  1747. X!     mode = (mode ? O_BINARY : O_TEXT) | O_WRONLY | O_CREAT | O_TRUNC;
  1748. X! #else
  1749. X!     mode = O_WRONLY | O_CREAT | O_TRUNC;
  1750. X! #endif
  1751. X!     if ((lfd=open(str,mode,0644)) < 0) {
  1752. X          lfd=1; 
  1753. X          lprintf("error creating file <%s>\n",str); 
  1754. X          lflush(); 
  1755. X***************
  1756. X*** 589,606 ****
  1757. X  }
  1758. X  
  1759. X  /*
  1760. X!  *    lopen(filename)            Open a file for read
  1761. X   *        char *filename;
  1762. X   *
  1763. X   *    lopen(0) means from the terminal
  1764. X   *    Returns -1 if error, otherwise the file descriptor opened.
  1765. X   */
  1766. X! lopen(str)
  1767. X  char *str;
  1768. X  {
  1769. X      ipoint = iepoint = MAXIBUF;
  1770. X      if (str==0) return(fd=0);
  1771. X!     if ((fd=open(str,0)) < 0) {
  1772. X          lwclose(); 
  1773. X          lfd=1; 
  1774. X          lpnt=lpbuf; 
  1775. X--- 672,697 ----
  1776. X  }
  1777. X  
  1778. X  /*
  1779. X!  *    lopen(filename, mode)        Open a file for read
  1780. X   *        char *filename;
  1781. X+  *        int mode;
  1782. X   *
  1783. X+  *    mode is 0 for text files and 1 for binary files.
  1784. X   *    lopen(0) means from the terminal
  1785. X   *    Returns -1 if error, otherwise the file descriptor opened.
  1786. X   */
  1787. X! lopen(str, mode)
  1788. X  char *str;
  1789. X+ int mode;
  1790. X  {
  1791. X      ipoint = iepoint = MAXIBUF;
  1792. X      if (str==0) return(fd=0);
  1793. X! #ifdef __MSDOS__
  1794. X!     mode = (mode ? O_BINARY : O_TEXT) | O_RDONLY;
  1795. X! #else
  1796. X!     mode = O_RDONLY;
  1797. X! #endif
  1798. X!     if ((fd=open(str,mode)) < 0) {
  1799. X          lwclose(); 
  1800. X          lfd=1; 
  1801. X          lpnt=lpbuf; 
  1802. X***************
  1803. X*** 610,628 ****
  1804. X  }
  1805. X  
  1806. X  /*
  1807. X!  *    lappend(filename)        Open for append to an existing file
  1808. X   *        char *filename;
  1809. X   *
  1810. X   *    lappend(0) means to the terminal
  1811. X   *    Returns -1 if error, otherwise the file descriptor opened.
  1812. X   */
  1813. X! lappend(str)
  1814. X  char *str;
  1815. X  {
  1816. X      lpnt = lpbuf;    
  1817. X      lpend = lpbuf+BUFBIG;
  1818. X      if (str==0) return(lfd=1);
  1819. X!     if ((lfd=open(str,2)) < 0) {
  1820. X          lfd=1; 
  1821. X          return(-1);
  1822. X      }
  1823. X--- 701,727 ----
  1824. X  }
  1825. X  
  1826. X  /*
  1827. X!  *    lappend(filename, mode)        Open for append to an existing file
  1828. X   *        char *filename;
  1829. X+  *        int mode;
  1830. X   *
  1831. X+  *    mode is 0 for text files and 1 for binary files.
  1832. X   *    lappend(0) means to the terminal
  1833. X   *    Returns -1 if error, otherwise the file descriptor opened.
  1834. X   */
  1835. X! lappend(str, mode)
  1836. X  char *str;
  1837. X+ int mode;
  1838. X  {
  1839. X      lpnt = lpbuf;    
  1840. X      lpend = lpbuf+BUFBIG;
  1841. X      if (str==0) return(lfd=1);
  1842. X! #ifdef __MSDOS__
  1843. X!     mode = (mode ? O_BINARY : O_TEXT) | O_WRONLY | O_APPEND;
  1844. X! #else
  1845. X!     mode = O_WRONLY | O_APPEND;
  1846. X! #endif
  1847. X!     if ((lfd=open(str,mode)) < 0) {
  1848. X          lfd=1; 
  1849. X          return(-1);
  1850. X      }
  1851. X***************
  1852. X*** 664,670 ****
  1853. X      if (lpnt >= lpend) 
  1854. X          lflush(); 
  1855. X      str2 = lpnt;
  1856. X!     while (*str2++ = *str++)
  1857. X          ;
  1858. X      lpnt = str2 - 1;
  1859. X  }
  1860. X--- 763,769 ----
  1861. X      if (lpnt >= lpend) 
  1862. X          lflush(); 
  1863. X      str2 = lpnt;
  1864. X!     while ((*str2++ = *str++)!=0)
  1865. X          ;
  1866. X      lpnt = str2 - 1;
  1867. X  }
  1868. X***************
  1869. X*** 708,713 ****
  1870. X--- 807,813 ----
  1871. X   */
  1872. X  init_term()
  1873. X  {
  1874. X+ #ifndef __MSDOS__
  1875. X      char termbuf[1024];
  1876. X      char *capptr = cap+10;
  1877. X      char *term;
  1878. X***************
  1879. X*** 760,768 ****
  1880. X          fflush(stderr);
  1881. X          exit(1);
  1882. X      }
  1883. X      /* get memory for decoded output buffer*/
  1884. X      if ((outbuf=malloc(BUFBIG+16))==0) {
  1885. X!       fprintf(stderr,"Error malloc'ing memory for decoded output buffer\n");
  1886. X          fflush(stderr);
  1887. X          died(-285);    /* malloc() failure */
  1888. X      }
  1889. X--- 860,896 ----
  1890. X          fflush(stderr);
  1891. X          exit(1);
  1892. X      }
  1893. X+ #else /* __MSDOS__ */
  1894. X+ 
  1895. X+     static char sobuf[20], sebuf[20];
  1896. X+ 
  1897. X+     CM = "\033[%d;%dH";  /* Cursor motion */
  1898. X+     CE = "\033[K";       /* Clear to eoln */
  1899. X+     CL = "\033[2J";      /* Clear screen */
  1900. X+ 
  1901. X+     /* OPTIONAL */
  1902. X+     if (nansi) {
  1903. X+         AL = "\033[L";       /* Insert line */
  1904. X+         DL = "\033[M";       /* Delete line */
  1905. X+     }
  1906. X+     else {
  1907. X+         AL = NULL;           /* Insert line */
  1908. X+         DL = NULL;           /* Delete line */
  1909. X+     }
  1910. X+ 
  1911. X+     sprintf(sobuf, "\033[1;%d;%dm", fg_color + 30, bg_color + 40);
  1912. X+     sprintf(sebuf, "\033[0;%d;%dm", fg_color + 30, bg_color + 40);
  1913. X+ 
  1914. X+     SO = sobuf;      /* Begin standout mode */
  1915. X+     SE = sebuf;      /* End standout mode */
  1916. X+     CD = NULL;  /* Clear to end of display */
  1917. X+ 
  1918. X+     puts(sebuf);
  1919. X+ #endif /* __MSDOS__ */
  1920. X+ 
  1921. X      /* get memory for decoded output buffer*/
  1922. X      if ((outbuf=malloc(BUFBIG+16))==0) {
  1923. X!         fprintf(stderr,"Error malloc'ing memory for decoded output buffer\n");
  1924. X          fflush(stderr);
  1925. X          died(-285);    /* malloc() failure */
  1926. X      }
  1927. X***************
  1928. X*** 839,844 ****
  1929. X--- 967,990 ----
  1930. X  {
  1931. X      enable_scroll = -1;
  1932. X  }
  1933. X+ 
  1934. X+ #ifdef __MSDOS__
  1935. X+ 
  1936. X+ void tputs(char *s, int x, int (*outch)())
  1937. X+ {
  1938. X+   while (*s) (*outch)(*s++);
  1939. X+   ++x;
  1940. X+ }
  1941. X+ 
  1942. X+ char *tgoto(char *s, int x, int y)
  1943. X+ {
  1944. X+   static char buf[12];
  1945. X+ 
  1946. X+   sprintf(buf, s, y+1, x+1);
  1947. X+   return buf;
  1948. X+ }
  1949. X+ 
  1950. X+ #endif  /* __MSDOS__ */
  1951. X  
  1952. X  /*
  1953. X   *    lflush()                    Flush the output buffer
  1954. SHAR_EOF
  1955. if test 50636 -ne "`wc -c < 'patch02.1'`"
  1956. then
  1957.     echo shar: error transmitting "'patch02.1'" '(should have been 50636 characters)'
  1958. fi
  1959. fi # end of overwriting check
  1960. #    End of shell archive
  1961. exit 0
  1962.